<style type="text/css">
    .menuParentTree .menuName {
        cursor: pointer;
    }
</style>
<script type="text/javascript">
    $(document).ready(function () {
        var menuParentTree = $('.menuParentTree').jTree();
        menuParentTree.showAll(0);
    });
    LC.S.saveParent = function (value, parentName) {
        if (!confirm('父级将变更为：' + parentName)) {
            return;
        }
        $.getJSON(LC.S.serviceUrl+'/update.do', {
            'update.id': LC.S.id,
            'update.name': 'PARENT_ID',
            'update.value': value
        }, function (rs) {
            if (rs.code == code.SUCCESS || rs.code == code.FINISH) {
                $('.menuParentTree').parent().dialog('close');
                LC.S.fleshTree();
                LC.S.detail(LC.S.id);
            } else {
                alert(msg[rs.code]);
            }
        });
    }
</script>
<div class="menuParentTree">
    <div id="menu_0" pid="">
        <span class="menuName" title="点击添加根菜单" onClick="LC.S.saveParent('','顶级菜单')">
            <span class="icon-libreoffice"></span>
            <span class="name">顶级菜单</span>
        </span>
    </div>
<#list menus as m>
    <div id="${m._id}" pid="${m.parentId!"menu_0"}">
            <span class="menuName" title="${m.notes!}" onClick="LC.S.saveParent('${m._id}','${m.name}')">
                <span class="icon-libreoffice"></span>
                <span class="name">${m.name}</span>
            </span>
    </div>
</#list>
</div>